<template>
  <div v-show='isClassLableStatus'>
    <a-card title='基础信息'>
      <j-form-container :disabled='formDisabled' style='cursor: text'>
        <a-form-model ref='form' :model='model' slot='detail'>
          <a-row>
            <a-col :span='6'>
              <a-form-model-item label='班级编码' prop='classCode'>
                <a-input v-model='model.classCode' placeholder='请输入班级编码'></a-input>
              </a-form-model-item>
            </a-col>
            <a-col :span='6'>
              <a-form-model-item label='班级名称' prop='className'>
                <a-input v-model='model.className' placeholder='请输入班级名称'></a-input>
              </a-form-model-item>
            </a-col>
            <a-col :span='6'>
              <a-form-model-item label='班级简称' prop='classNickname'>
                <a-input v-model='model.classNickname' placeholder='请输入班级简称'></a-input>
              </a-form-model-item>
            </a-col>
            <a-col :span='6'>
              <a-form-model-item label='班级类型' prop='classTtype'>
                <j-dict-select-tag type='list' style='width: 150px' v-model='model.classTtype' dictCode='class_ttype'
                                   placeholder='请选择班级类型' />
              </a-form-model-item>
            </a-col>
            <a-col :span='6'>
              <a-form-model-item label='班级容量' prop='classStudentCapacity'>
                <a-input-number v-model='model.classStudentCapacity' placeholder='请输入班级容量' style='width: 100%' />
              </a-form-model-item>
            </a-col>
            <a-col :span='6'>
              <a-form-model-item label='班级状态' prop='classStatus'>
                <j-dict-select-tag type='list' style='width: 150px' v-model='model.classStatus' dictCode='class_status'
                                   placeholder='请选择班级状态' />
              </a-form-model-item>
            </a-col>
            <a-col :span='6'>
              <a-form-model-item label='班主任' prop='classHeadmasterCode'>
                <j-dict-select-tag type='list' style='width: 150px' v-model='model.classHeadmasterCode'
                                   dictCode='tea_teacher,teacher_name,id'
                                   placeholder='请选择班主任' />
              </a-form-model-item>
            </a-col>
            <a-col :span='6'>
              <a-form-model-item label='班级人数' prop='classStudentCount'>
                <a-input-number v-model='model.classStudentCount' placeholder='请输入班级人数' style='width: 100%' />
              </a-form-model-item>
            </a-col>
            <a-col :span='6'>
              <a-form-model-item label='班级排序' prop='classOrder'>
                <a-input-number v-model='model.classOrder' placeholder='请输入班级排序' style='width: 100%' />
              </a-form-model-item>
            </a-col>
            <a-col :span='6'>
              <a-form-model-item label='班级备注' prop='classRemark'>
                <a-input v-model='model.classRemark' placeholder='请输入班级备注'></a-input>
              </a-form-model-item>
            </a-col>
            <a-col :span='6'>
              <a-form-model-item label='所在年级' prop='gradeCode'>
                <j-dict-select-tag type='list' style='width: 150px' v-model='model.gradeCode' dictCode=''
                                   placeholder='请选择年级'
                                   dictCode='cou_grade,grade_name,id' />
              </a-form-model-item>
            </a-col>
          </a-row>
        </a-form-model>
      </j-form-container>
    </a-card>
    <a-card
      style='width: 100%'
      title='扩展信息'
      :tab-list='tabList'
      :active-tab-key='key'
      @tabChange="key => onTabChange(key, 'key')"
    >
      <RelClassStudentListComp :classId='classId' :isRelClassStudentShow='isRelClassStudentListStuCompShow'></RelClassStudentListComp>
      <RelClassSubjectTeacherListComp :isRelClassSubjectTeacherListCompShow='isRelClassSubjectTeacherListCompShow'
                                      :classId='classId'></RelClassSubjectTeacherListComp>
      <FacClassroomListComp :class-id='classId' :is-fac-classroom-list-show='isFacClassroomListShow'></FacClassroomListComp>
      <CouTeachingJobExecuteListComp :class-id='classId' :isCouTeachingJobExecuteListCompShow='isCouTeachingJobExecuteListCompShow'></CouTeachingJobExecuteListComp>

      <AchClassAchievementExamScoreListylvComp :grade-code='gradeCode' :class-id-new='classId' :isAchClassAchievementExamScoreListylvCompShow='isAchClassAchievementExamScoreListylvCompShow'></AchClassAchievementExamScoreListylvComp>
      <AchClassAchievementExamScoreListComp :grade-code='gradeCode' :class-id-new='classId' :isAchClassAchievementExamScoreListCompShow='isAchClassAchievementExamScoreListCompShow'></AchClassAchievementExamScoreListComp>
      <AchClassSubjectScoreListComp :grade-code='gradeCode' :class-id-new='classId' :isAchClassSubjectScoreListCompShow='isAchClassSubjectScoreListCompShow'></AchClassSubjectScoreListComp>
      <AchClassSubjectProjScoreListComp :grade-code='gradeCode' :class-id-new='classId' :isAchClassSubjectProjScoreListCompShow='isAchClassSubjectProjScoreListCompShow'></AchClassSubjectProjScoreListComp>
    </a-card>
  </div>
</template>

<script>

import { httpAction, getAction } from '@api/manage'
import { validateDuplicateValue } from '@/utils/util'
import RelClassStudentListComp from '@views/smart_school/relation/rel_class_student/RelClassStudentListComp'
import RelClassSubjectTeacherListComp
  from '@views/smart_school/relation/rel_cls_tea_sub_room/RelClassSubjectTeacherListComp'
import FacClassroomListComp from '@views/smart_school/classroom/FacClassroomListComp'
import CouTeachingJobExecuteListComp from '@views/smart_school/couteachingjobexecute/CouTeachingJobExecuteListComp'
import AchClassAchievementExamScoreListylvComp
  from '@views/analysis/analysisachievement/achclasses/AchClassAchievementExamScoreListylvComp'
import AchClassAchievementExamScoreListComp
  from '@views/analysis/analysisachievement/achclasses/AchClassAchievementExamScoreListComp'
import AchClassSubjectScoreListComp from '@views/analysis/analysisachievement/achclasses/AchClassSubjectScoreListComp'
import AchClassSubjectProjScoreListComp
  from '@views/analysis/analysisachievement/achclasses/AchClassSubjectProjScoreListComp'

export default {
  name: 'CouClassLable',
  components: {
    FacClassroomListComp,
    RelClassSubjectTeacherListComp,
    RelClassStudentListComp,
    CouTeachingJobExecuteListComp,
    AchClassAchievementExamScoreListylvComp,
    AchClassAchievementExamScoreListComp,
    AchClassSubjectScoreListComp,
    AchClassSubjectProjScoreListComp
  },
  props: {
    isClassLableStatus: {
      type: Boolean,
      default: false,
      required: false
    },
    classVo: {
      type: Object,
      default: false
    }
  },
  watch: {
    classVo: {
      immediate: true,
      handler() {
        Object.assign(this.model, this.classVo)
        this.classId = this.model.id
        this.gradeCode = this.model.gradeCode
        this.checkValueKeyIsShow(this.key)
      }
    }
  },
  data() {
    return {
      disableMixinCreated : true, //默认初始状态不加载数据
      model: {},
      formDisabled: true,
      classId: '',
      gradeCode: '',
      tabList: [
        {
          key: 'RelClassStudentListComp',
          tab: '班级学生'
        },
        {
          key: 'RelClassSubjectTeacherListComp',
          tab: '班级教师'
        },
        {
          key: 'FacClassroomListComp',
          tab: '教室场地'
        },
        {
          key: 'CouTeachingJobExecuteListComp',
          tab: '执行课表'
        },
        {
          key: 'AchClassAchievementExamScoreListylvComp',
          tab: '班级总成绩优良率'
        },
        {
          key: 'AchClassAchievementExamScoreListComp',
          tab: '班级总成绩优良人数'
        },
        {
          key: 'AchClassSubjectScoreListComp',
          tab: '班级科目成绩'
        },
        {
          key: 'AchClassSubjectProjScoreListComp',
          tab: '班级题型优良率'
        },
      ],
      key: 'RelClassStudentListComp',
      isRelClassStudentListStuCompShow: false,
      isRelClassSubjectTeacherListCompShow: false,
      isFacClassroomListShow: false,
      isCouTeachingJobExecuteListCompShow: false,
      isAchClassAchievementExamScoreListylvCompShow: false,
      isAchClassAchievementExamScoreListCompShow: false,
      isAchClassSubjectScoreListCompShow: false,
      isAchClassSubjectProjScoreListCompShow: false,
    }
  },
  computed: {},
  created() {
  },
  mounted() {
    this.clearValue()
  },
  methods: {
    onTabChange(value, type) {
      this.key = value
      this.checkValueKeyIsShow(this.key)

    },
    checkValueKeyIsShow(key) {
      this.isRelClassStudentListStuCompShow = false
      this.isRelClassSubjectTeacherListCompShow = false
      this.isFacClassroomListShow = false
      this.isCouTeachingJobExecuteListCompShow = false
      this.isAchClassAchievementExamScoreListylvCompShow = false
      this.isAchClassAchievementExamScoreListCompShow = false
      this.isAchClassSubjectScoreListCompShow = false
      this.isAchClassSubjectProjScoreListCompShow = false


      if (key == 'RelClassStudentListComp') {
        this.isRelClassStudentListStuCompShow = true
      }
      if (key == 'RelClassSubjectTeacherListComp') {
        this.isRelClassSubjectTeacherListCompShow = true
      }
      if (key == 'FacClassroomListComp') {
        this.isFacClassroomListShow = true
      }
      if (key == 'CouTeachingJobExecuteListComp') {
        this.isCouTeachingJobExecuteListCompShow = true
      }

      if (key == 'AchClassAchievementExamScoreListylvComp') {
        this.isAchClassAchievementExamScoreListylvCompShow = true
      }
      if (key == 'AchClassAchievementExamScoreListComp') {
        this.isAchClassAchievementExamScoreListCompShow = true
      }
      if (key == 'AchClassSubjectScoreListComp') {
        this.isAchClassSubjectScoreListCompShow = true
      }
      if (key == 'AchClassSubjectProjScoreListComp') {
        this.isAchClassSubjectProjScoreListCompShow = true
      }
    },
    clearValue() {
      this.model = {}
      this.classId = ''
      this.gradeCode = ''
    }
  }
}
</script>